<?
include_once("./_common.php");

$write_table = "manage_list";

$mn_addr = $a_addr1." ".$a_addr2;
$mn_phone = $mn_phone1."-".$mn_phone2."-".$mn_phone3;
$area_name = $_POST['area_name'];
$mn_zip = $a_zip1."-".$a_zip2;

if ($member[mb_id])
{
	$mb_id = $member[mb_id];
	$wr_name = $board[bo_use_name] ? $member[mb_name] : $member[mb_nick];
	$wr_password = $member[mb_password];
	$wr_email = $member[mb_email];
	$wr_homepage = $member[mb_homepage];
}
else
{
	$mb_id = "";
	// 비회원의 경우 이름이 누락되는 경우가 있음
	$wr_name = strip_tags(mysql_escape_string($_POST['wr_name']));
	if (!trim($wr_name))
		alert("이름은 필히 입력하셔야 합니다.");
	$wr_password = sql_password($wr_password);
}


$string = "mn_name = '$mn_name',
	area_id = '$area_id',
	area_name = '$area_name',
	mn_addr = '$mn_addr',
	mn_phone = '$mn_phone',
	mn_hours = '$mn_hours',
	open_type = '$mn_open',
	mn_zip = '$mn_zip'
	";

if ($w == "")
{
	$sql = "INSERT
			INTO $write_table
			SET $string";
	$rst = sql_query($sql);
}
else if ($w == "u")
{
	$sql = "UPDATE $write_table
			SET $string
			WHERE mn_id = '$mn_id'";
	$rst = sql_query($sql);
}
else if ($w == "d")
{
	$sql = "DELETE
			FROM $write_table
			WHERE mn_id = '$mn_id'";
	$rst = sql_query($sql);
}
//$wr_id = mysql_insert_id();

if ($g4[https_url])
	$https_url = "$g4[url]/adm/adm_new";
else
	$https_url = ".";

if ($file_upload_msg)
	alert($file_upload_msg, "{$https_url}/manage_list.php?bo_table=$bo_table&wr_id=$wr_id&page=$page" . $qstr);
else
	goto_url("{$https_url}/manage_list.php?bo_table=$bo_table&mn_id=$mn_id&page=$page" . $qstr);


?>